package com.nbot.server.job;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.nbot.server.service.KeyParameterMonthService;
import com.nbot.server.util.DateUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 重要参数每月归档，本job执行时，会对当前时间的上个月进行归档，统计每个参数值的max、min、avg、sum这4个量
 */
@Component
public class KeyParameterMonthJob implements Job {
    private static final Log LOGGER = LogFactory.get();
    @Autowired
    private KeyParameterMonthService keyParameterMonthService;

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        LOGGER.info("执行重要参数每月归档任务");


        String lastMonthStr = DateUtils.getLastMonthString();
        keyParameterMonthService.generateLog(lastMonthStr);

    }

}